enum ComponentType {
  TABLE = 'Table',
  VIEW = 'View',
  MATERIALIZED_VIEW = 'MaterializedView',

  MODEL = 'Model',
  QUERY = 'Query',
}

type TabPosition = 'all' | 'data' | 'model' | 'query';
type actionType = 'add' | 'remove';
export {
  ComponentType
};
export type {
  TabPosition,
  actionType
};
const createCaseVariants = (types: any[]) =>
  types.flatMap(type => [type, type.toUpperCase()]);

export const sqlTypesObj = {
  timeTypes: createCaseVariants([
    'date', 'time', 'datetime', 'year', 'timestamp', 'date_time'
  ]),
  stringTypes: createCaseVariants([
    'char', 'varchar', 'text', 'tinytext', 'mediumtext', 'longtext', 'enum', 'set'
  ]),
  numberTypes: createCaseVariants([
    'tinyint', 'smallint', 'mediumint', 'int', 'bigint',
    'float', 'double', 'decimal',
    'bit', 'boolean', 'serial', 'long'
  ])
};

export enum dataTypeEnum {
  STRING = 1,
  NUMBER = 2,
  TIME = 3,
}
export enum DimensionMeasurementEnum {
  Dimension = 'Dimension',//维度
  Measurement = 'Metrics',//度量
  // TimeDimension = 3,//时间维度
}
export const getMetricsOptionsChange = (dataType: dataTypeEnum) => {
  let options: any[] = [];
  if (dataType == dataTypeEnum.NUMBER) {
    options = [
      { label: '度量', value: DimensionMeasurementEnum.Measurement },
      { label: '维度', value: DimensionMeasurementEnum.Dimension },
    ]
  } else if (dataType == dataTypeEnum.STRING) {
    options = [
      { label: '度量', value: DimensionMeasurementEnum.Measurement, disabled: true },
      { label: '维度', value: DimensionMeasurementEnum.Dimension },
    ]
  } else if (dataType == dataTypeEnum.TIME) {
    options = [
      { label: '度量', value: DimensionMeasurementEnum.Measurement, disabled: true },
      { label: '维度', value: DimensionMeasurementEnum.Dimension },
      // { label: '时间维度', value: DimensionMeasurementEnum.TimeDimension },
    ]
  }
  return options;
}